Skip to content

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented Jun 29, 2025

Q A
Bug fix? no
New feature? no
Docs? no
Issues Fix #...
License MIT

I plan to deprecate @symfony/stimulus-testing, the library is too much opinionated by depending on Jest and Babel.

From 837 to 442 (dev)dependencies 🎉

@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Jun 29, 2025
@Kocal Kocal changed the title Remove @symfony/stimulus-testing Remove @symfony/stimulus-testing Jun 29, 2025
@Kocal Kocal changed the title Remove @symfony/stimulus-testing Remove @symfony/stimulus-testing dev dependencies Jun 29, 2025
@Kocal Kocal force-pushed the remove-symfony-stimulus-testing branch 3 times, most recently from 102c0bb to 6ccc009 Compare June 29, 2025 12:44
@smnandre
Copy link
Member

So we only used two DOM-related methods from the @stimulus/testing ?

(the ones you moved in the ../../../helper file)

Are people using it to test their controllers ?

@Kocal Kocal force-pushed the remove-symfony-stimulus-testing branch 2 times, most recently from 000eb1a to 68bdf65 Compare June 29, 2025 12:54
@Kocal
Copy link
Member Author

Kocal commented Jun 29, 2025

So we only used two DOM-related methods from the @stimulus/testing ?

(the ones you moved in the ../../../helper file)

Yes, and the import '@testing-library/jest-dom'; from test/setup.js files

Are people using it to test their controllers ?

It always had few downloads per week (see stats), but since mid-May it started to grows to ~16k downloads per week.
But I don't know if it's due to my changes on Symfony UX CI, or if someone else started to use the package.

@Kocal Kocal force-pushed the remove-symfony-stimulus-testing branch from 68bdf65 to bbe6bd1 Compare June 29, 2025 13:05
@smnandre
Copy link
Member

So maybe we can stop using it ourselves... and see then, depending on the activity, if we deprecate it ?

@Kocal
Copy link
Member Author

Kocal commented Jun 29, 2025

Let's debate on https://github.com/symfony/stimulus-testing if you want, but for me there is no point to this library, either for maintainers or users.

@Kocal Kocal merged commit b7582c6 into symfony:2.x Jun 29, 2025
31 checks passed
@smnandre
Copy link
Member

You cannot say « I suggest we deprecate » then say « Lets not dizcyss it » haha

IF (and that is a big if) there is a growing usage of the lib, it deserves maybe to suggest them an alternative, and probably some documentation updates, that’s all i’m saying

@Kocal Kocal deleted the remove-symfony-stimulus-testing branch June 29, 2025 15:32
Kocal added a commit to symfony/stimulus-testing that referenced this pull request Jul 5, 2025
This PR was merged into the main branch.

Discussion
----------

Deprecate the package

I don't think there is any interest in _maintaining_ it anymore. Because of Jest and Babel, installing ``@symfony`/stimulus-testing` installs [**~500 subdependencies**](https://npmgraph.js.org/?q=%40symfony%2Fstimulus-testing), which is totally unacceptable, since the added-value of this package is only these two functions:
```js
export function mountDOM(html = '') {
    const div = document.createElement('div');
    div.innerHTML = html;
    document.body.appendChild(div);

    return div;
}

export function clearDOM() {
    document.body.innerHTML = '';
}
```

It's like a Composer package, but all its dependencies being shadowed and not removable by the final user.

Removing it from `@symfony`/ux, where we don't use Jest and Babel but Vitest, allowed us to remove ~400 useless Node.js dev dependencies: symfony/ux#2879

The package is still experimental, and I suggest to deprecate this package. I've added migration steps for people being stuck with it, even if I think we, Symfony, are maybe the only ones to use it:

https://github.com/user-attachments/assets/86a21c37-8560-43dc-bec9-0043875831ea

We can observe:
1. it always had ~1k downloads per week this last year,
2. more recently we had ~21k downloads per week, and I believe that's correlated to my last two-months work on UX
3. and since a few days, it started to drop again (currently at 8k downloads for the last full week), when I removed it from UX

Commits
-------

07d2209 Deprecate the package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Review Needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants